<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <style type="text/css">
        /*定义动画*/
        @keyframes moving{
            from{
                width: 100px;

            }
            to{
                width: 500px;
            }
        }

        .box{
            width: 100px;
            height: 100px;
            background-color: gold;
            animation: moving 1s ease 0s infinite alternate;
            animation-play-state: paused;
        }
        .box:hover{
            animation-play-state:running
        }

    </style>
</head>
<body>
    <div class="box">

    </div>

</body>
</html>